#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{

    if(recordAudioThread == nullptr) {

        recordAudioThread = new RecordAudioThread();

        connect(recordAudioThread,&QThread::finished,[this](){

            ui->pushButton->setText("录音");
            recordAudioThread = nullptr;
        });

        recordAudioThread->start();
        ui->pushButton->setText("暂停");

    }else{

        recordAudioThread->requestInterruption();
    }


}
